﻿<Controls:MetroWindow x:Class="SweetWeather.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowStyle="None" AllowsTransparency="True" 
        xmlns:local="clr-namespace:SweetWeather"
        xmlns:model="clr-namespace:SweetWeather.Model"
        xmlns:viewModel="clr-namespace:SweetWeather.ViewModel"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        Height="600" Width="970" WindowStartupLocation="CenterScreen" Title="SweetWeather"
        BorderThickness="1" BorderBrush="#1D82DA" ShowTitleBar="True" ShowIconOnTitleBar="False" Icon="../images/logo.ico"
        ShowMaxRestoreButton="False" ResizeMode="CanMinimize" MaxHeight="600" MaxWidth="970"
        Closed="MetroWindow_Closed">
    <Window.Background>
        <ImageBrush ImageSource="{Binding BackGround.Path, Mode=TwoWay}" Stretch="Fill">
        </ImageBrush>
    </Window.Background>
    <Controls:MetroWindow.WindowCommands>
        <Controls:WindowCommands>
            <Button Focusable="False" Content="关于" Name="btnAbout" Click="btnAbout_Click" />
        </Controls:WindowCommands>
    </Controls:MetroWindow.WindowCommands>

    <Controls:MetroWindow.Flyouts>
        <!--城市列表-->
        <Controls:Flyout Name="flyCityList" IsOpen="False" Header="城市列表" Position="Right">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>
                <Button Command="{Binding GetProvince}" Click="btnShowAddCity_Click" Width="100" Height="25" Name="btnShowAddCity" Style="{StaticResource ButtonStyle}">
                    <WrapPanel>
                        <Path HorizontalAlignment="Left" Data="M19.833,0L32.5,0 32.5,19.833999 52.334,19.833999 52.334,32.500999 32.5,32.500999 32.5,52.333 19.833,52.333 19.833,32.500999 0,32.500999 0,19.833999 19.833,19.833999z" 
                              Stretch="Uniform" Fill="White" Width="13" Height="13" Margin="0,2,5,0" RenderTransformOrigin="0.5,0.5">
                        </Path>
                        <TextBlock Foreground="White" HorizontalAlignment="Right" Text="添加城市" FontSize="15" FontWeight="Bold"/>
                    </WrapPanel>
                </Button>
                <ListBox Grid.Row="1" Name="CityListBox" SelectionChanged="ListBox_SelectionChanged"  Width="150" BorderThickness="0" DisplayMemberPath="Name" MaxHeight="500" Height="Auto" Background="Transparent" ItemsSource="{Binding CityList}" Style="{x:Null}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectionChanged">
                            <i:InvokeCommandAction Command="{Binding Path=DataContext.ChangeCity,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}}" 
                                                                   CommandParameter="{Binding Path=SelectedValue,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel></StackPanel>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="FontSize" Value="20"/>
                            <!--<Setter Property="Foreground" Value="White"/>-->
                            <Setter Property="FontWeight" Value="Bold"/>
                            <Setter Property="Margin" Value="0,5,0,5"/>
                            <Setter Property="BorderThickness" Value="0"/>
                            <Style.Triggers>
                                <Trigger Property="ListBoxItem.IsMouseOver" Value="True">
                                    <Setter Property="TextBlock.FontSize" Value="22"/>
                                </Trigger>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="TextBlock.Foreground" Value="White"/>
                                    <Setter Property="BorderBrush" Value="White"/>
                                    <Setter Property="BorderThickness" Value="1"/>
                                </Trigger>
                                <Trigger Property="IsSelected" Value="False">
                                    <Setter Property="TextBlock.Foreground" Value="Gray"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </ListBox.ItemContainerStyle>
                </ListBox>
            </Grid>
        </Controls:Flyout>
        <Controls:Flyout Name="flyAddCity" Header="添加城市" Position="Right">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="140"></RowDefinition>
                    <RowDefinition Height="40"></RowDefinition>
                    <RowDefinition Height="40"></RowDefinition>
                    <RowDefinition Height="40"></RowDefinition>
                </Grid.RowDefinitions>
                <ComboBox Text="-请选择-" SelectedIndex="0" ItemsSource="{Binding ProvinceBindingList,Mode=TwoWay}"
                          SelectedItem="{Binding SelectProvince,Mode=TwoWay}" DisplayMemberPath="Name"
                          Margin="5,105,5,5" Width="100" Name="cboProvince" Style="{StaticResource ComboBoxStyle}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectionChanged">
                            <i:InvokeCommandAction Command="{Binding Path=DataContext.GetCity,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ComboBox}}" 
                                                                   CommandParameter="{Binding Path=SelectedValue,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ComboBox}}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </ComboBox>
                <ComboBox SelectedIndex="0" ItemsSource="{Binding CityBindingList,Mode=TwoWay}" DisplayMemberPath="Name"
                           SelectedItem="{Binding SelectCity,Mode=TwoWay}" Margin="5" Width="100" Grid.Row="1" 
                          Name="cboCity" Style="{StaticResource ComboBoxStyle}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectionChanged">
                            <i:InvokeCommandAction Command="{Binding Path=DataContext.GetArea,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ComboBox}}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </ComboBox>
                <ComboBox SelectedIndex="0" ItemsSource="{Binding AreaBindingList,Mode=TwoWay}" DisplayMemberPath="Name" 
                          SelectedItem="{Binding SelectCity,Mode=TwoWay}" Margin="5" Width="100" Grid.Row="2" 
                          Name="cboArea" Style="{StaticResource ComboBoxStyle}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectionChanged">
                            <i:InvokeCommandAction Command="{Binding Path=DataContext.GetAddCityInfo,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ComboBox}}" 
                                                                   CommandParameter="{Binding Path=SelectedValue,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ComboBox}}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </ComboBox>
                <Button Click="btnAdd_Click" Command="{Binding SaveCity}" Grid.Row="3" Width="60" Height="25" Name="btnAdd" Style="{StaticResource ButtonStyle}">
                    <WrapPanel>
                        <Path Data="F1M574.042,314.611L533.8,344.398 522.251,328.798 515.235,333.988 526.786,349.593 526.782,349.596 531.978,356.603 579.235,321.622 574.042,314.611z" 
                              Stretch="Uniform" Fill="White" Width="13" Height="13" Margin="0,2,5,0" RenderTransformOrigin="0.5,0.5"/>
                        <TextBlock HorizontalAlignment="Right" Text="添加" Foreground="White" FontSize="15" FontWeight="Bold"/>
                    </WrapPanel>
                </Button>
            </Grid>
        </Controls:Flyout>
    </Controls:MetroWindow.Flyouts>

    <Controls:MetroContentControl>
        <TabControl x:Name="TabWeatherControl" Foreground="White">
            <TabItem Header="实况">
                <Canvas Background="Transparent" Width="970">
                    <Rectangle Fill="Gray" Opacity="0.2" Width="930" Height="480" Canvas.Left="18" Canvas.Top="10">
                    </Rectangle>
                    <Grid Margin="20,10" Width="930" Height="500" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20"></RowDefinition>
                            <RowDefinition Height="70"></RowDefinition>
                            <RowDefinition Height="350"></RowDefinition>
                            <RowDefinition Height="30"></RowDefinition>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="320"></ColumnDefinition>
                            <ColumnDefinition Width="350"></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Controls:ProgressIndicator Grid.ColumnSpan="3" Name="progressLoading" ProgressColour="White" Width="900" Height="6" HorizontalAlignment="Center"/>
                        <WrapPanel Grid.Row="1" Margin="20,0,20,0">
                            <TextBlock Name="tbCurrentCity" FontSize="50" Text="{Binding BackGround.CurrentCity.Name}" ToolTip="{Binding BackGround.CurrentCity.FullName}" Style="{StaticResource TextBlockStyle}"/>
                            <Button Click="btnChange_Click" Focusable="False" BorderThickness="0" Name="btnChange" Height="40" Width="40" Margin="20,10,0,10" ToolTip="切换城市" Cursor="Hand" Style="{StaticResource ButtonStyle}">
                                <Path Data="F1M568.254,-7.43524L568.159,-7.34277 567.977,-7.52246 546.559,-28.9417 525.484,-28.9417 549.787,-4.63446 557.439,3.01532 557.619,3.19629 550.067,10.7549 525.758,35.0583 546.834,35.0583 568.254,13.6429 578.792,3.10254 568.254,-7.43524z" 
                                      Stretch="Uniform" Fill="#FFF9F9F9" Width="30" Height="30" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5">
                                </Path>
                            </Button>
                        </WrapPanel>
                        <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Margin="0,0,0,20">
                            <TextBlock Name="tblToday" Foreground="White" FontSize="17"/>
                        </StackPanel>
                        <Grid Grid.Row="2">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="180"></RowDefinition>
                                <RowDefinition Height="70"></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <WrapPanel>
                                <TextBlock HorizontalAlignment="Center" Margin="{Binding RealTimeWeather.tempmargin}" Name="tblRealTimeTemp" Text="{Binding RealTimeWeather.temp}" FontSize="{Binding RealTimeWeather.celsiusTextFontSize}" FontFamily="黑体" Style="{StaticResource TextBlockStyle}"/>
                                <StackPanel>
                                    <Button HorizontalAlignment="Right" Command="{Binding GetWeatherInfo}" CommandParameter="RealTime" Focusable="False" BorderThickness="0"  Name="btnRefresh" Height="40" Width="40" Margin="20,2,0,0" ToolTip="刷新" Cursor="Hand" Style="{StaticResource ButtonStyle}">
                                        <Path Data="M2.7499252,30.299848L18.669936,37.698865 14.349932,40.728464C17.789935,43.70807 22.169938,45.567823 26.799941,45.567823 35.689946,45.567823 43.469952,39.758592 45.309953,31.289716L45.599953,30.639802 53.339959,30.639802 52.979958,31.949628C50.759957,44.417974 39.749951,52.776868 26.799941,52.776868 19.539937,52.776868 12.809932,49.897249 7.8799284,44.937906L4.2499259,47.387582z M26.539532,0C33.809293,-6.8510417E-08,40.529256,2.7602325,45.459096,7.7205935L49.089028,5.050457 50.589001,21.701824 34.669381,15.291273 38.989247,12.360982C35.549249,9.3807617 31.16945,7.7306042 26.539532,7.7306042 17.649688,7.7306042 9.8698071,13.921167 8.0298765,22.401832L7.7398427,23.832002 0,23.832002 0.3599781,21.681804C2.5799068,9.2108264,13.589706,-6.8510417E-08,26.539532,0z" 
                                      Stretch="Uniform" Fill="White" Width="30" Height="30" Margin="0,-2,0,0" RenderTransformOrigin="0.5,0.5">
                                        </Path>
                                    </Button>
                                    <TextBlock Margin="10,10,0,0" Text="℃" FontSize="{Binding RealTimeWeather.celsiusFontSize}" FontFamily="黑体" Style="{StaticResource TextBlockStyle}"/>
                                </StackPanel>
                            </WrapPanel>
                            <WrapPanel Grid.Row="1">
                                <TextBlock Margin="30,10,20,0" Name="tblweatherName" Text="{Binding TodayWeather.weather}" FontSize="40" Style="{StaticResource TextBlockStyle}"/>
                                <TextBlock Name="tblRealTime" ToolTip="数据发布时间" VerticalAlignment="Center" FontSize="20" Text="{Binding RealTimeWeather.time}" Style="{StaticResource TextBlockStyle}"/>
                            </WrapPanel>
                            <StackPanel Grid.Row="3">
                                <WrapPanel Margin="20,20,0,0">
                                    <TextBlock FontWeight="Normal" Text="风向风力：" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock FontWeight="Normal" Name="tblWD" Text="{Binding RealTimeWeather.WD}" ToolTip="风向风力" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock FontWeight="Normal" Text="，" ToolTip="风向风力" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock FontWeight="Normal" Name="tblWS" Text="{Binding RealTimeWeather.WS}" ToolTip="风向风力" Style="{StaticResource TextBlockStyle}"/>
                                </WrapPanel>
                                <WrapPanel Margin="20,10,0,0">
                                    <TextBlock FontWeight="Normal" Text="相对湿度：" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock FontWeight="Normal" Name="tblSD" Text="{Binding RealTimeWeather.SD}" ToolTip="相对湿度" Style="{StaticResource TextBlockStyle}"/>
                                </WrapPanel>
                            </StackPanel>
                        </Grid>
                        <Grid Grid.Row="2" Grid.Column="1">
                            <Grid.RowDefinitions>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Canvas>
                                <Rectangle Height="110" Width="170" Margin="0,0,5,5" Fill="Black" Opacity="0.3" >
                                </Rectangle>
                                <WrapPanel Margin="0,0,5,5" Orientation="Horizontal" Width="170" Height="110">
                                    <Image VerticalAlignment="Center" Source="{Binding MoreDayWeather.img1}" Width="80" Height="80"/>
                                    <StackPanel Width="90" Height="90">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,5,5,0" FontSize="20" Style="{StaticResource TextBlockStyle}" ToolTip="日期" Name="tblDay1Week" Text="今天"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontSize="18" Style="{StaticResource TextBlockStyle}" ToolTip="天气名称" Name="tblDay1Weather" Text="{Binding MoreDayWeather.weather1}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontWeight="Normal" FontSize="15" Style="{StaticResource TextBlockStyle}" ToolTip="温度" Name="tblDay1Temp" Text="{Binding MoreDayWeather.temp1}"/>
                                    </StackPanel>
                                    <StackPanel Width="170" Height="20">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,0,15,0"  FontWeight="Normal" FontSize="13" Style="{StaticResource TextBlockStyle}" ToolTip="{Binding MoreDayWeather.fl1}" Name="tblDay1WD" Text="{Binding MoreDayWeather.wind1}"/>
                                    </StackPanel>
                                </WrapPanel>
                            </Canvas>
                            <Canvas  Grid.Column="1">
                                <Rectangle  Height="110" Width="170" Fill="Black" Opacity="0.3" />
                                <WrapPanel Margin="0,0,5,5" Orientation="Horizontal" Width="170" Height="110">
                                    <Image VerticalAlignment="Center" Source="{Binding MoreDayWeather.img3}" Width="80" Height="80"/>
                                    <StackPanel Width="90" Height="90">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,5,5,0" FontSize="20" Style="{StaticResource TextBlockStyle}" ToolTip="日期" Name="tblDay2Week" Text="{Binding MoreDayWeather.week2}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontSize="18" Style="{StaticResource TextBlockStyle}" ToolTip="天气名称" Name="tblDay2Weather" Text="{Binding MoreDayWeather.weather2}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontWeight="Normal" FontSize="15" Style="{StaticResource TextBlockStyle}" ToolTip="温度" Name="tblDay2Temp" Text="{Binding MoreDayWeather.temp2}"/>
                                    </StackPanel>
                                    <StackPanel Width="170" Height="20">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,0,15,0"  FontWeight="Normal" FontSize="13" Style="{StaticResource TextBlockStyle}" ToolTip="{Binding MoreDayWeather.fl1}" Name="tblDay2WD" Text="{Binding MoreDayWeather.wind2}"/>
                                    </StackPanel>
                                </WrapPanel>
                            </Canvas>
                            <Canvas  Grid.Row="1">
                                <Rectangle Margin="0,0,5,5"  Height="110" Width="170" Fill="Black" Opacity="0.3" >
                                </Rectangle>
                                <WrapPanel Margin="0,0,5,5" Orientation="Horizontal" Width="170" Height="110">
                                    <Image VerticalAlignment="Center" Source="{Binding MoreDayWeather.img5}" Width="80" Height="80"/>
                                    <StackPanel Width="90" Height="90">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,5,5,0" FontSize="20" Style="{StaticResource TextBlockStyle}" ToolTip="日期" Name="tblDay3Week" Text="{Binding MoreDayWeather.week3}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontSize="18" Style="{StaticResource TextBlockStyle}" ToolTip="天气名称" Name="tblDay3Weather" Text="{Binding MoreDayWeather.weather3}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontWeight="Normal" FontSize="15" Style="{StaticResource TextBlockStyle}" ToolTip="温度" Name="tblDay3Temp" Text="{Binding MoreDayWeather.temp3}"/>
                                    </StackPanel>
                                    <StackPanel Width="170" Height="20">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,0,15,0"  FontWeight="Normal" FontSize="13" Style="{StaticResource TextBlockStyle}" ToolTip="{Binding MoreDayWeather.fl1}" Name="tblDay3WD" Text="{Binding MoreDayWeather.wind3}"/>
                                    </StackPanel>
                                </WrapPanel>
                            </Canvas>
                            <Canvas Grid.Row="1" Grid.Column="1">
                                <Rectangle Margin="0,0,5,5"  Height="110" Width="170" Fill="Black" Opacity="0.3" >
                                </Rectangle>
                                <WrapPanel Margin="0,0,5,5" Orientation="Horizontal" Width="170" Height="110">
                                    <Image VerticalAlignment="Center" Source="{Binding MoreDayWeather.img7}" Width="80" Height="80"/>
                                    <StackPanel Width="90" Height="90">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,5,5,0" FontSize="20" Style="{StaticResource TextBlockStyle}" ToolTip="日期" Name="tblDay4Week" Text="{Binding MoreDayWeather.week4}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontSize="18" Style="{StaticResource TextBlockStyle}" ToolTip="天气名称" Name="tblDay4Weather" Text="{Binding MoreDayWeather.weather4}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontWeight="Normal" FontSize="15" Style="{StaticResource TextBlockStyle}" ToolTip="温度" Name="tblDay4Temp" Text="{Binding MoreDayWeather.temp4}"/>
                                    </StackPanel>
                                    <StackPanel Width="170" Height="20">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,0,15,0"  FontWeight="Normal" FontSize="13" Style="{StaticResource TextBlockStyle}" ToolTip="{Binding MoreDayWeather.fl1}" Name="tblDay4WD" Text="{Binding MoreDayWeather.wind4}"/>
                                    </StackPanel>
                                </WrapPanel>
                            </Canvas>
                            <Canvas Grid.Row="2">
                                <Rectangle  Margin="0,0,5,5"  Height="110" Width="170" Fill="Black" Opacity="0.3" >
                                </Rectangle>
                                <WrapPanel Margin="0,0,5,5" Orientation="Horizontal" Width="170" Height="110">
                                    <Image VerticalAlignment="Center" Source="{Binding MoreDayWeather.img9}" Width="80" Height="80"/>
                                    <StackPanel Width="90" Height="90">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,5,5,0" FontSize="20" Style="{StaticResource TextBlockStyle}" ToolTip="日期" Name="tblDay5Week" Text="{Binding MoreDayWeather.week5}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontSize="18" Style="{StaticResource TextBlockStyle}" ToolTip="天气名称" Name="tblDay5Weather" Text="{Binding MoreDayWeather.weather5}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontWeight="Normal" FontSize="15" Style="{StaticResource TextBlockStyle}" ToolTip="温度" Name="tblDay5Temp" Text="{Binding MoreDayWeather.temp5}"/>
                                    </StackPanel>
                                    <StackPanel Width="170" Height="20">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,0,15,0"  FontWeight="Normal" FontSize="13" Style="{StaticResource TextBlockStyle}" ToolTip="{Binding MoreDayWeather.fl1}" Name="tblDay5WD" Text="{Binding MoreDayWeather.wind5}"/>
                                    </StackPanel>
                                </WrapPanel>
                            </Canvas>
                            <Canvas Grid.Row="2" Grid.Column="1">
                                <Rectangle  Margin="0,0,5,5" Height="110" Width="170" Fill="Black" Opacity="0.3" >
                                </Rectangle>
                                <WrapPanel Margin="0,0,5,5" Orientation="Horizontal" Width="170" Height="110">
                                    <Image VerticalAlignment="Center" Source="{Binding MoreDayWeather.img11}" Width="80" Height="80"/>
                                    <StackPanel Width="90" Height="90">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,5,5,0" FontSize="20" Style="{StaticResource TextBlockStyle}" ToolTip="日期" Name="tblDay6Week" Text="{Binding MoreDayWeather.week6}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontSize="18" Style="{StaticResource TextBlockStyle}" ToolTip="天气名称" Name="tblDay6Weather" Text="{Binding MoreDayWeather.weather6}"/>
                                        <TextBlock HorizontalAlignment="Right" Margin="5,5,15,0" FontWeight="Normal" FontSize="15" Style="{StaticResource TextBlockStyle}" ToolTip="温度" Name="tblDay6Temp" Text="{Binding MoreDayWeather.temp6}"/>
                                    </StackPanel>
                                    <StackPanel Width="170" Height="20">
                                        <TextBlock HorizontalAlignment="Right" Margin="0,0,15,0"  FontWeight="Normal" FontSize="13" Style="{StaticResource TextBlockStyle}" ToolTip="{Binding MoreDayWeather.fl1}" Name="tblDay6WD" Text="{Binding MoreDayWeather.wind6}"/>
                                    </StackPanel>
                                </WrapPanel>
                            </Canvas>
                        </Grid>
                        <StackPanel Grid.Column="2" Grid.Row="2" Margin="20,0,0,0">
                            <Canvas Height="40" Margin="0,0,0,3.3">
                                <Rectangle Height="40" Width="213" Fill="Black" Opacity="0.3"/>
                                <WrapPanel ToolTip="{Binding MoreDayWeather.index_d}">
                                    <Image Source="../images/lifeico/cy.png" Height="40" Width="40" />
                                    <TextBlock VerticalAlignment="Center" Text="穿衣：" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock VerticalAlignment="Center" Name="tblCY" Text="{Binding MoreDayWeather.index}" Style="{StaticResource TextBlockStyle}"/>
                                </WrapPanel>
                            </Canvas>
                            <Canvas Height="40" Margin="0,0,0,3.3">
                                <Rectangle Height="40" Width="213" Fill="Black" Opacity="0.3"/>
                                <WrapPanel>
                                    <Image Source="../images/lifeico/fs.png" Height="40" Width="40" />
                                    <TextBlock VerticalAlignment="Center" Text="防晒：" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock VerticalAlignment="Center" Name="tblFS" Text="{Binding MoreDayWeather.index_uv}" Style="{StaticResource TextBlockStyle}"/>
                                </WrapPanel>
                            </Canvas>
                            <Canvas Height="40" Margin="0,0,0,3.3">
                                <Rectangle Height="40" Width="213" Fill="Black" Opacity="0.3"/>
                                <WrapPanel>
                                    <Image Source="../images/lifeico/xc.png" Height="40" Width="40" />
                                    <TextBlock VerticalAlignment="Center" Text="洗车：" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock VerticalAlignment="Center" Name="tblxc" Text="{Binding MoreDayWeather.index_xc}" Style="{StaticResource TextBlockStyle}"/>
                                </WrapPanel>
                            </Canvas>
                            <Canvas Height="40" Margin="0,0,0,3.3">
                                <Rectangle Height="40" Width="213" Fill="Black" Opacity="0.3"/>
                                <WrapPanel>
                                    <Image Source="../images/lifeico/ly.png" Height="40" Width="40" />
                                    <TextBlock VerticalAlignment="Center" Text="旅游：" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock VerticalAlignment="Center" Name="tblLY" Text="{Binding MoreDayWeather.index_tr}" Style="{StaticResource TextBlockStyle}"/>
                                </WrapPanel>
                            </Canvas>
                            <Canvas Height="40" Margin="0,0,0,3.3">
                                <Rectangle Height="40" Width="213" Fill="Black" Opacity="0.3"/>
                                <WrapPanel>
                                    <Image Source="../images/lifeico/ss.png" Height="40" Width="40" />
                                    <TextBlock VerticalAlignment="Center" Text="舒适：" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock VerticalAlignment="Center" Name="tblSS" Text="{Binding MoreDayWeather.index_co}" Style="{StaticResource TextBlockStyle}"/>
                                </WrapPanel>
                            </Canvas>
                            <Canvas Height="40" Margin="0,0,0,3.3">
                                <Rectangle Height="40" Width="213" Fill="Black" Opacity="0.3"/>
                                <WrapPanel>
                                    <Image Source="../images/lifeico/cl.png" Height="40" Width="40" />
                                    <TextBlock VerticalAlignment="Center" Text="晨练：" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock VerticalAlignment="Center" Name="tblCL" Text="{Binding MoreDayWeather.index_cl}" Style="{StaticResource TextBlockStyle}"/>
                                </WrapPanel>
                            </Canvas>
                            <Canvas Height="40" Margin="0,0,0,3.3">
                                <Rectangle Height="40" Width="213" Fill="Black" Opacity="0.3"/>
                                <WrapPanel>
                                    <Image Source="../images/lifeico/ls.png" Height="40" Width="40" />
                                    <TextBlock VerticalAlignment="Center" Text="晾晒：" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock VerticalAlignment="Center" Name="tblLS" Text="{Binding MoreDayWeather.index_ls}" Style="{StaticResource TextBlockStyle}"/>
                                </WrapPanel>
                            </Canvas>
                            <Canvas Height="40" Margin="0,0,0,3.3">
                                <Rectangle Height="40" Width="213" Fill="Black" Opacity="0.3"/>
                                <WrapPanel>
                                    <Image Source="../images/lifeico/gm.png" Height="40" Width="40" />
                                    <TextBlock VerticalAlignment="Center" Text="过敏：" Style="{StaticResource TextBlockStyle}"/>
                                    <TextBlock VerticalAlignment="Center" Name="tblGM" Text="{Binding MoreDayWeather.index_ag}" Style="{StaticResource TextBlockStyle}"/>
                                </WrapPanel>
                            </Canvas>
                        </StackPanel>
                        <TextBlock HorizontalAlignment="Left" Grid.Column="1" Width="95" Grid.Row="3" Cursor="Hand" Foreground="#E3E3E3" FontSize="15" TextDecorations="UnderLine" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown" Text="更多天气预报"/>
                        <TextBlock HorizontalAlignment="Left" Grid.Column="2" Width="65" Grid.Row="3" Cursor="Hand" Foreground="#E3E3E3"  FontSize="15" Margin="20,0,0,0" TextDecorations="UnderLine" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown" Text="更多指数"/>
                        <WrapPanel Grid.ColumnSpan="3" Grid.Row="4"  VerticalAlignment="Bottom" Margin="0,0,0,5" HorizontalAlignment="Left" >
                            <WrapPanel HorizontalAlignment="Left">
                                <TextBlock Style="{StaticResource TextBlockStyle}" FontWeight="Normal" FontSize="12" Text="更新于："/>
                                <TextBlock Style="{StaticResource TextBlockStyle}" FontWeight="Normal" FontSize="12" Name="tblLastUpdateTime" Text="{Binding BackGround.LastUpdateTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss},Mode=TwoWay}"/>
                            </WrapPanel>
                        </WrapPanel>
                    </Grid>

                </Canvas>
            </TabItem>
            <TabItem Header="日历">
                <Frame Source="CalendarPage.xaml" NavigationUIVisibility="Hidden"/>
            </TabItem>
            <TabItem Header="系统设置">
                <Canvas Background="Transparent" Width="970">
                    <Rectangle Fill="Gray" Opacity="0.3" Width="930" Height="480" Canvas.Left="18" Canvas.Top="10">
                    </Rectangle>
                    <Grid Margin="20" Width="930" Height="510">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="80"></RowDefinition>
                            <RowDefinition Height="100"></RowDefinition>
                            <RowDefinition Height="150"></RowDefinition>
                            <RowDefinition Height="40"></RowDefinition>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="360"></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <WrapPanel Orientation="Horizontal" Margin="0,30,0,0">
                            <TextBlock Text="天气主题"  Margin="10,10,0,10" Style="{StaticResource TextBlockStyle}" HorizontalAlignment="Left"></TextBlock>
                            <ComboBox Name="cboImageType" ItemsSource="{Binding ThemsesList,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="Key"
                                      SelectedValue="{Binding BackGround.Themes,Mode=TwoWay}" Margin="10" Width="100" HorizontalAlignment="Left" Style="{StaticResource ComboBoxStyle}">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="SelectionChanged">
                                        <i:InvokeCommandAction Command="{Binding Path=DataContext.GetImagesList,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ComboBox}}" 
                                                                   CommandParameter="{Binding Path=SelectedValue,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ComboBox}}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </ComboBox>
                            <Button Content="浏览" Cursor="Hand" Width="80" Height="25" Style="{StaticResource ButtonStyle}" Visibility="{Binding IsShowOpen}" Command="{Binding OpenCostomImage}"></Button>
                        </WrapPanel>
                        <WrapPanel Grid.RowSpan="2" Grid.ColumnSpan="2" Grid.Row="1" x:Name="ImgListPanel" Width="930" HorizontalAlignment="Center">
                            <Border Margin="10,0,10,0" BorderBrush="#1D82DA" BorderThickness="1" Width="910" Height="230" HorizontalAlignment="Center">
                                <ListBox Background="Transparent" ItemsSource="{Binding ImageList,Mode=TwoWay}" Name="ListBoxThemes" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                                    <ListBox.Resources>
                                        <!--Selected color when the ListBox is focused-->
                                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#1D82DA" />
                                        <!--Selected color when the ListBox is not focused-->
                                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#1D82DA" />
                                    </ListBox.Resources>
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Image x:Name="bgImg" Margin="5" Source="{Binding Value}" Width="148.2" Height="90" Stretch="Fill">
                                                <i:Interaction.Triggers>
                                                    <i:EventTrigger EventName="MouseEnter">
                                                        <i:InvokeCommandAction Command="{Binding Path=DataContext.ChangeBackGround,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}}" 
                                                                   CommandParameter="{Binding Value}" />
                                                    </i:EventTrigger>
                                                </i:Interaction.Triggers>
                                            </Image>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                    <ListBox.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <WrapPanel></WrapPanel>
                                        </ItemsPanelTemplate>
                                    </ListBox.ItemsPanel>
                                </ListBox>
                            </Border>
                        </WrapPanel>
                        <WrapPanel Grid.Row="3">
                            <TextBlock Text="数据更新间隔"  Margin="10,10,0,0" Style="{StaticResource TextBlockStyle}" HorizontalAlignment="Left"/>
                            <TextBox Name="txtRefreshMin"  Width="50" Margin="10,15,0,0" MaxLength="4" Style="{StaticResource TextBoxStyle}">
                                <TextBox.Text>
                                    <Binding Path="BackGround.RefreshMin" ValidatesOnDataErrors="True" NotifyOnValidationError="True" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
                                        <Binding.ValidationRules>
                                            <DataErrorValidationRule></DataErrorValidationRule>
                                        </Binding.ValidationRules>
                                    </Binding>
                                </TextBox.Text>
                                <Validation.ErrorTemplate>
                                    <ControlTemplate>
                                        <DockPanel LastChildFill="true">
                                            <Border Background="Red" DockPanel.Dock="right" Margin="5,0,0,0" Width="20" Height="20" CornerRadius="10"
                            ToolTip="{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
                                                <TextBlock Text="!" VerticalAlignment="center" HorizontalAlignment="center" FontWeight="Bold" Foreground="white">
                                                </TextBlock>
                                            </Border>
                                            <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center" >
                                                <Border BorderBrush="red" BorderThickness="1" />
                                            </AdornedElementPlaceholder>
                                        </DockPanel>
                                    </ControlTemplate>
                                </Validation.ErrorTemplate>
                            </TextBox>
                            <TextBlock Text="分钟" Style="{StaticResource TextBlockStyle}" Margin="2,14,0,0" FontSize="16"/>
                        </WrapPanel>
                        <WrapPanel Grid.Row="3" Grid.Column="1">
                            <TextBlock Text="开启自启动" Cursor="Hand" Margin="0,10,0,0" Style="{StaticResource TextBlockStyle}" HorizontalAlignment="Left"/>
                            <Controls:ToggleSwitch OnLabel="ON" OffLabel="OFF" BorderBrush="White" IsChecked="{Binding BackGround.IsAutoOpen}"/>
                        </WrapPanel>
                        <WrapPanel Grid.Row="4" Grid.ColumnSpan="2" HorizontalAlignment="Right">
                            <Button Content="应用" Cursor="Hand" Margin="10" Width="80" x:Name="btnApply" Click="btnApply_Click" Height="25" Style="{StaticResource ButtonStyle}" Command="{Binding SaveSetting}"></Button>
                            <Button Content="取消" Cursor="Hand" Click="btnCancel_Click" Margin="5,10,20,10" x:Name="btnCancel" Width="80" Height="25" Style="{StaticResource ButtonStyle}"></Button>
                        </WrapPanel>
                    </Grid>
                </Canvas>
            </TabItem>
        </TabControl>
    </Controls:MetroContentControl>
</Controls:MetroWindow>
